﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Bootstrap5;

public class CssEnumeration : Enumeration<string>
{
    protected CssEnumeration() { }

    protected CssEnumeration(string css) : this(css, css) { }
    protected CssEnumeration(string name, string css) : base(name, css)
    {
    }
}

public abstract class Enumeration<TValue>
{
    protected Enumeration() { }
    public Enumeration(string name, TValue value)
    {
        Name = name;
        Value = value;
    }

    public string Name { get; }
    public TValue Value { get; }

    public static IEnumerable<T> GetAll<T>() where T:Enumeration<TValue>
        => typeof(T).GetFields(BindingFlags.Public |
                            BindingFlags.Static |
                            BindingFlags.DeclaredOnly)
                 .Select(f => f.GetValue(null))
                 .Cast<T>();
}
